<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.7"/>
<title>BrainTrain: GUI/KeyHandler.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">BrainTrain
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.7 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('_key_handler_8cpp_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">KeyHandler.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_key_handler_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#include &quot;../header/KeyHandler.h&quot;</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#include &quot;../header/UtilFunctions.h&quot;</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#include &lt;osgUtil/CullVisitor&gt;</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &lt;osgUtil/LineSegmentIntersector&gt;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &lt;osg/ValueObject&gt;</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;</div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="keyword">namespace </span>brtr {</div>
<div class="line"><a name="l00008"></a><span class="lineno"><a class="line" href="classbrtr_1_1_key_handler.html#aaae067fabc959780a9fae9c700c199da">    8</a></span>&#160;    <a class="code" href="classbrtr_1_1_key_handler.html#aaae067fabc959780a9fae9c700c199da">KeyHandler::KeyHandler</a>(osg::Node* rootNode, osg::Camera* postProcessCam, std::vector&lt;osg::ref_ptr&lt;osg::Program&gt;&gt; programs) :</div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;        _programs(programs),</div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;        _postProcessCam(postProcessCam),</div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;        _rootNode(rootNode),</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;        _isWireFrame(false),</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;        _curProg(0){</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;        <a class="code" href="classbrtr_1_1_key_handler.html#a7aff4e23d4c614d8e0ccdc29a3c8882f">_wireFrameMode</a> = <span class="keyword">new</span> osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE);</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;        <a class="code" href="classbrtr_1_1_key_handler.html#ae210945e48748029cbea37fde7d601b5">_normaleMode</a> = <span class="keyword">new</span> osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::FILL);</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;    }</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;</div>
<div class="line"><a name="l00019"></a><span class="lineno"><a class="line" href="classbrtr_1_1_key_handler.html#aabad0b142ba1d2e648069b4e8af17797">   19</a></span>&#160;    <a class="code" href="classbrtr_1_1_key_handler.html#aabad0b142ba1d2e648069b4e8af17797">KeyHandler::~KeyHandler</a>() {}</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;</div>
<div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="classbrtr_1_1_key_handler.html#a02df9f4339712d5b8b2b25b89048cf47">   21</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classbrtr_1_1_key_handler.html#a02df9f4339712d5b8b2b25b89048cf47">KeyHandler::handle</a>(<span class="keyword">const</span> osgGA::GUIEventAdapter&amp; ea, osgGA::GUIActionAdapter&amp; aa) {</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;        <span class="keywordflow">switch</span> (ea.getEventType()) {</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;        <span class="keywordflow">case</span> osgGA::GUIEventAdapter::FRAME:</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;            <a class="code" href="classbrtr_1_1_key_handler.html#a7f402d48b863ed19ef47038a32d1d05c">mouseIntersection</a>(aa);</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;            <span class="comment">//return false;</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;        <span class="keywordflow">case</span> osgGA::GUIEventAdapter::MOVE:</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;        <span class="keywordflow">case</span> osgGA::GUIEventAdapter::DRAG:</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;        <span class="keywordflow">case</span> osgGA::GUIEventAdapter::RELEASE:</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;            <a class="code" href="classbrtr_1_1_key_handler.html#a1b2404dcd19426a93d4474cd45da84e8">_mouseEvent</a> = &amp;ea;</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;        <span class="keywordflow">case</span> osgGA::GUIEventAdapter::PUSH:</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;            <a class="code" href="classbrtr_1_1_key_handler.html#a1b2404dcd19426a93d4474cd45da84e8">_mouseEvent</a> = &amp;ea;</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;            <span class="keywordflow">if</span> (ea.getButton() == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON) {</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;                <a class="code" href="classbrtr_1_1_base_interaction_callback.html">brtr::BaseInteractionCallback</a>* callback = <a class="code" href="classbrtr_1_1_key_handler.html#a1925fa114839192716167477714abfdc">modifyText</a>(<span class="keyword">false</span>);</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;                <span class="keywordflow">if</span> (callback) {</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;                    OSG_NOTICE &lt;&lt; <span class="stringliteral">&quot;Attaching callback&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;                    <span class="keywordflow">if</span> (callback-&gt;<a class="code" href="classbrtr_1_1_base_interaction_callback.html#aafca24ccde1cf21f4132f65a83e0b2bc">getNode</a>()-&gt;getUpdateCallback() == callback)</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;                        callback-&gt;<a class="code" href="classbrtr_1_1_base_interaction_callback.html#a95ede7c8aa0dc1e067ae64615ecb23db">reactivate</a>();</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;                    <span class="keywordflow">else</span></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;                        callback-&gt;<a class="code" href="classbrtr_1_1_base_interaction_callback.html#aafca24ccde1cf21f4132f65a83e0b2bc">getNode</a>()-&gt;addUpdateCallback(callback);</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;                }<span class="comment">// callback</span></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;                </div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;            }</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;        <span class="keywordflow">case</span> osgGA::GUIEventAdapter::KEYDOWN:</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;            <span class="keywordflow">return</span> <a class="code" href="classbrtr_1_1_key_handler.html#a5af6a6e66e8754591b3425addc6e6858">handleKeyDown</a>(ea, aa);</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;        <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;        }</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;    }<span class="comment">//hanlde()</span></div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;</div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="classbrtr_1_1_key_handler.html#a5af6a6e66e8754591b3425addc6e6858">   53</a></span>&#160;    <span class="keywordtype">bool</span> <a class="code" href="classbrtr_1_1_key_handler.html#a5af6a6e66e8754591b3425addc6e6858">KeyHandler::handleKeyDown</a>(<span class="keyword">const</span> osgGA::GUIEventAdapter&amp; ea, osgGA::GUIActionAdapter&amp; aa) {</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;        <span class="keywordflow">switch</span> (ea.getUnmodifiedKey()) {</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;            <span class="comment">//Turn PolygonMode on/off</span></div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;        <span class="keywordflow">case</span> osgGA::GUIEventAdapter::KEY_C: {</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;            osg::PolygonMode* curMode = <a class="code" href="classbrtr_1_1_key_handler.html#a6939e2c5e93e53d6090c999eae2fb927">_isWireFrame</a> ? <a class="code" href="classbrtr_1_1_key_handler.html#ae210945e48748029cbea37fde7d601b5">_normaleMode</a> : <a class="code" href="classbrtr_1_1_key_handler.html#a7aff4e23d4c614d8e0ccdc29a3c8882f">_wireFrameMode</a>;</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;            <a class="code" href="classbrtr_1_1_key_handler.html#a2ff68d9c79145d235f50fec1da625f99">_rootNode</a>-&gt;getOrCreateStateSet()-&gt;setAttributeAndModes(curMode);</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;            <a class="code" href="classbrtr_1_1_key_handler.html#a6939e2c5e93e53d6090c999eae2fb927">_isWireFrame</a> = !<a class="code" href="classbrtr_1_1_key_handler.html#a6939e2c5e93e53d6090c999eae2fb927">_isWireFrame</a>;</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;        }<span class="comment">//case KEY_C</span></div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;        <span class="keywordflow">case</span> osgGA::GUIEventAdapter::KEY_1:{</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;            <span class="keywordflow">if</span> (ea.getModKeyMask() == osgGA::GUIEventAdapter::MODKEY_LEFT_SHIFT) {</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;                <a class="code" href="classbrtr_1_1_key_handler.html#aa4cc5f6ac9134e473f37968dfb1dd821">_postProcessCam</a>-&gt;getOrCreateStateSet()-&gt;removeAttribute(<a class="code" href="classbrtr_1_1_key_handler.html#a492d086b9458475e595b3627a8dee0f9">_programs</a>[<a class="code" href="classbrtr_1_1_key_handler.html#a578b374029e318a509983a01253a7736">_curProg</a>]);</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;                _curProg++;</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;                _curProg = _curProg % <a class="code" href="classbrtr_1_1_key_handler.html#a492d086b9458475e595b3627a8dee0f9">_programs</a>.size();</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;                <a class="code" href="classbrtr_1_1_key_handler.html#aa4cc5f6ac9134e473f37968dfb1dd821">_postProcessCam</a>-&gt;getOrCreateStateSet()-&gt;setAttributeAndModes(<a class="code" href="classbrtr_1_1_key_handler.html#a492d086b9458475e595b3627a8dee0f9">_programs</a>[_curProg], osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;            }</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;        }   <span class="comment">//KEY_1</span></div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;        <span class="keywordflow">default</span>:</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;        }<span class="comment">//switch  </span></div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    }<span class="comment">//if(KEYDOWN)</span></div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;</div>
<div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="classbrtr_1_1_key_handler.html#a7f402d48b863ed19ef47038a32d1d05c">   76</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classbrtr_1_1_key_handler.html#a7f402d48b863ed19ef47038a32d1d05c">KeyHandler::mouseIntersection</a>(osgGA::GUIActionAdapter&amp; aa) {</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;        osg::ref_ptr&lt;osg::Camera&gt; camera = aa.asView()-&gt;getCamera();</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;        <span class="keywordflow">if</span> (!<a class="code" href="classbrtr_1_1_key_handler.html#a1b2404dcd19426a93d4474cd45da84e8">_mouseEvent</a> || !camera)</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;            <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;        osg::Vec3d eyeInWorld = osg::Vec3d() *osg::Matrixd::inverse(camera-&gt;getViewMatrix());</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;        osg::ref_ptr&lt;osgUtil::LineSegmentIntersector&gt; lIntersector =</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;            <span class="keyword">new</span> osgUtil::LineSegmentIntersector(osgUtil::Intersector::WINDOW, <a class="code" href="classbrtr_1_1_key_handler.html#a1b2404dcd19426a93d4474cd45da84e8">_mouseEvent</a>-&gt;getX(), <a class="code" href="classbrtr_1_1_key_handler.html#a1b2404dcd19426a93d4474cd45da84e8">_mouseEvent</a>-&gt;getY());</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;        lIntersector-&gt;setIntersectionLimit(osgUtil::Intersector::LIMIT_NEAREST);</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;        osgUtil::IntersectionVisitor iv(lIntersector);</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;        iv.setTraversalMask(<a class="code" href="namespacebrtr.html#a2060f4d70c0e3bc7e2e35f82e279a40d">interactionMask</a>);</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;        camera-&gt;accept(iv);</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;        <span class="keywordflow">if</span> (lIntersector-&gt;containsIntersections()) {</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;            <span class="keyword">auto</span> intersection = lIntersector-&gt;getIntersections().begin();           </div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;            <span class="keywordtype">double</span> curDistance = (eyeInWorld - intersection-&gt;getWorldIntersectPoint()).length();</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;            <span class="keywordflow">if</span> (curDistance &lt; 4.5 ) {</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;                <a class="code" href="classbrtr_1_1_key_handler.html#a4b0e380186a8172af6cf7c10dcff675a">_curDrawable</a> = intersection-&gt;drawable;</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;                <a class="code" href="classbrtr_1_1_key_handler.html#a1925fa114839192716167477714abfdc">modifyText</a>(<span class="keyword">true</span>);</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;            }<span class="comment">//if (curDistance &lt; distance)</span></div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;            <span class="keywordflow">else</span> {<span class="comment">//not the right distance, remove Text &amp; drawable, if any were present</span></div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;                <a class="code" href="classbrtr_1_1_key_handler.html#a1925fa114839192716167477714abfdc">modifyText</a>(<span class="keyword">false</span>);</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;            }<span class="comment">//else</span></div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;        }<span class="comment">//if (intersector-&gt;containsIntersections()</span></div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    }<span class="comment">//intersect()</span></div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;</div>
<div class="line"><a name="l00101"></a><span class="lineno"><a class="line" href="classbrtr_1_1_key_handler.html#a1925fa114839192716167477714abfdc">  101</a></span>&#160;    <a class="code" href="classbrtr_1_1_base_interaction_callback.html">brtr::BaseInteractionCallback</a>* <a class="code" href="classbrtr_1_1_key_handler.html#a1925fa114839192716167477714abfdc">KeyHandler::modifyText</a>(<span class="keywordtype">bool</span> show) {</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;        <a class="code" href="classbrtr_1_1_base_interaction_callback.html">brtr::BaseInteractionCallback</a>* callback =<span class="keyword">nullptr</span>;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;        <span class="keywordflow">if</span> (<a class="code" href="classbrtr_1_1_key_handler.html#a4b0e380186a8172af6cf7c10dcff675a">_curDrawable</a>) {</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;            OSG_NOTICE &lt;&lt; <span class="stringliteral">&quot;Checking Container...&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;            osg::UserDataContainer* container = <a class="code" href="classbrtr_1_1_key_handler.html#a4b0e380186a8172af6cf7c10dcff675a">_curDrawable</a>-&gt;getUserDataContainer();</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;            <span class="keywordflow">if</span> (container) {</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;                OSG_NOTICE &lt;&lt; <span class="stringliteral">&quot;Container True&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;                callback = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="classbrtr_1_1_base_interaction_callback.html">brtr::BaseInteractionCallback</a>*<span class="keyword">&gt;</span>(container-&gt;getUserObject(0));</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;                <span class="keywordflow">if</span> (callback) {</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;                    <span class="keywordflow">if</span> (show) callback-&gt;<a class="code" href="classbrtr_1_1_base_interaction_callback.html#a0fe57e329f044e21d49041c861435ad8">setText</a>();</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;                    <span class="keywordflow">else</span> callback-&gt;<a class="code" href="classbrtr_1_1_base_interaction_callback.html#ad74fe9ac5d86c7f23d18614d5abb1003">clearText</a>();</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;                }<span class="comment">// callback</span></div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;            }<span class="comment">//container</span></div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;        }<span class="comment">//_curDrawable</span></div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;        <span class="keywordflow">if</span> (!show)</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;            <a class="code" href="classbrtr_1_1_key_handler.html#a4b0e380186a8172af6cf7c10dcff675a">_curDrawable</a> = <span class="keyword">nullptr</span>;</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;        <span class="keywordflow">return</span> callback;</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    }<span class="comment">//modifyText()</span></div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;}<span class="comment">//namespace</span></div>
<div class="ttc" id="classbrtr_1_1_key_handler_html_a7f402d48b863ed19ef47038a32d1d05c"><div class="ttname"><a href="classbrtr_1_1_key_handler.html#a7f402d48b863ed19ef47038a32d1d05c">brtr::KeyHandler::mouseIntersection</a></div><div class="ttdeci">void mouseIntersection(osgGA::GUIActionAdapter &amp;aa)</div><div class="ttdoc">Checks, if under the mouse (e.a center of screen) is an interact-able object (e.a geometry) ...</div><div class="ttdef"><b>Definition:</b> <a href="_key_handler_8cpp_source.html#l00076">KeyHandler.cpp:76</a></div></div>
<div class="ttc" id="classbrtr_1_1_key_handler_html_a6939e2c5e93e53d6090c999eae2fb927"><div class="ttname"><a href="classbrtr_1_1_key_handler.html#a6939e2c5e93e53d6090c999eae2fb927">brtr::KeyHandler::_isWireFrame</a></div><div class="ttdeci">bool _isWireFrame</div><div class="ttdef"><b>Definition:</b> <a href="_key_handler_8h_source.html#l00060">KeyHandler.h:60</a></div></div>
<div class="ttc" id="classbrtr_1_1_key_handler_html_aaae067fabc959780a9fae9c700c199da"><div class="ttname"><a href="classbrtr_1_1_key_handler.html#aaae067fabc959780a9fae9c700c199da">brtr::KeyHandler::KeyHandler</a></div><div class="ttdeci">KeyHandler(osg::Node *, osg::Camera *postProcessCam, std::vector&lt; osg::ref_ptr&lt; osg::Program &gt;&gt; programs)</div><div class="ttdoc">Constructor. </div><div class="ttdef"><b>Definition:</b> <a href="_key_handler_8cpp_source.html#l00008">KeyHandler.cpp:8</a></div></div>
<div class="ttc" id="classbrtr_1_1_key_handler_html_ae210945e48748029cbea37fde7d601b5"><div class="ttname"><a href="classbrtr_1_1_key_handler.html#ae210945e48748029cbea37fde7d601b5">brtr::KeyHandler::_normaleMode</a></div><div class="ttdeci">osg::ref_ptr&lt; osg::PolygonMode &gt; _normaleMode</div><div class="ttdef"><b>Definition:</b> <a href="_key_handler_8h_source.html#l00056">KeyHandler.h:56</a></div></div>
<div class="ttc" id="classbrtr_1_1_key_handler_html_aa4cc5f6ac9134e473f37968dfb1dd821"><div class="ttname"><a href="classbrtr_1_1_key_handler.html#aa4cc5f6ac9134e473f37968dfb1dd821">brtr::KeyHandler::_postProcessCam</a></div><div class="ttdeci">osg::ref_ptr&lt; osg::Camera &gt; _postProcessCam</div><div class="ttdef"><b>Definition:</b> <a href="_key_handler_8h_source.html#l00057">KeyHandler.h:57</a></div></div>
<div class="ttc" id="classbrtr_1_1_key_handler_html_a02df9f4339712d5b8b2b25b89048cf47"><div class="ttname"><a href="classbrtr_1_1_key_handler.html#a02df9f4339712d5b8b2b25b89048cf47">brtr::KeyHandler::handle</a></div><div class="ttdeci">virtual bool handle(const osgGA::GUIEventAdapter &amp;ea, osgGA::GUIActionAdapter &amp;aa)</div><div class="ttdef"><b>Definition:</b> <a href="_key_handler_8cpp_source.html#l00021">KeyHandler.cpp:21</a></div></div>
<div class="ttc" id="classbrtr_1_1_base_interaction_callback_html_a0fe57e329f044e21d49041c861435ad8"><div class="ttname"><a href="classbrtr_1_1_base_interaction_callback.html#a0fe57e329f044e21d49041c861435ad8">brtr::BaseInteractionCallback::setText</a></div><div class="ttdeci">virtual void setText()=0</div><div class="ttdoc">sets the text on screen. Subclasses must override to set its own (info)text </div></div>
<div class="ttc" id="classbrtr_1_1_key_handler_html_a4b0e380186a8172af6cf7c10dcff675a"><div class="ttname"><a href="classbrtr_1_1_key_handler.html#a4b0e380186a8172af6cf7c10dcff675a">brtr::KeyHandler::_curDrawable</a></div><div class="ttdeci">osg::ref_ptr&lt; osg::Drawable &gt; _curDrawable</div><div class="ttdef"><b>Definition:</b> <a href="_key_handler_8h_source.html#l00053">KeyHandler.h:53</a></div></div>
<div class="ttc" id="classbrtr_1_1_base_interaction_callback_html_ad74fe9ac5d86c7f23d18614d5abb1003"><div class="ttname"><a href="classbrtr_1_1_base_interaction_callback.html#ad74fe9ac5d86c7f23d18614d5abb1003">brtr::BaseInteractionCallback::clearText</a></div><div class="ttdeci">void clearText()</div><div class="ttdef"><b>Definition:</b> <a href="_base_interaction_callback_8cpp_source.html#l00031">BaseInteractionCallback.cpp:31</a></div></div>
<div class="ttc" id="classbrtr_1_1_key_handler_html_a578b374029e318a509983a01253a7736"><div class="ttname"><a href="classbrtr_1_1_key_handler.html#a578b374029e318a509983a01253a7736">brtr::KeyHandler::_curProg</a></div><div class="ttdeci">unsigned int _curProg</div><div class="ttdef"><b>Definition:</b> <a href="_key_handler_8h_source.html#l00061">KeyHandler.h:61</a></div></div>
<div class="ttc" id="classbrtr_1_1_base_interaction_callback_html"><div class="ttname"><a href="classbrtr_1_1_base_interaction_callback.html">brtr::BaseInteractionCallback</a></div><div class="ttdoc">This is the TemplateClass for InteractionCallbacks. </div><div class="ttdef"><b>Definition:</b> <a href="_base_interaction_callback_8h_source.html#l00024">BaseInteractionCallback.h:24</a></div></div>
<div class="ttc" id="namespacebrtr_html_a2060f4d70c0e3bc7e2e35f82e279a40d"><div class="ttname"><a href="namespacebrtr.html#a2060f4d70c0e3bc7e2e35f82e279a40d">brtr::interactionMask</a></div><div class="ttdeci">const int interactionMask</div><div class="ttdef"><b>Definition:</b> <a href="_util_functions_8h_source.html#l00028">UtilFunctions.h:28</a></div></div>
<div class="ttc" id="classbrtr_1_1_key_handler_html_a2ff68d9c79145d235f50fec1da625f99"><div class="ttname"><a href="classbrtr_1_1_key_handler.html#a2ff68d9c79145d235f50fec1da625f99">brtr::KeyHandler::_rootNode</a></div><div class="ttdeci">osg::ref_ptr&lt; osg::Node &gt; _rootNode</div><div class="ttdef"><b>Definition:</b> <a href="_key_handler_8h_source.html#l00054">KeyHandler.h:54</a></div></div>
<div class="ttc" id="classbrtr_1_1_key_handler_html_a7aff4e23d4c614d8e0ccdc29a3c8882f"><div class="ttname"><a href="classbrtr_1_1_key_handler.html#a7aff4e23d4c614d8e0ccdc29a3c8882f">brtr::KeyHandler::_wireFrameMode</a></div><div class="ttdeci">osg::ref_ptr&lt; osg::PolygonMode &gt; _wireFrameMode</div><div class="ttdef"><b>Definition:</b> <a href="_key_handler_8h_source.html#l00055">KeyHandler.h:55</a></div></div>
<div class="ttc" id="classbrtr_1_1_key_handler_html_a5af6a6e66e8754591b3425addc6e6858"><div class="ttname"><a href="classbrtr_1_1_key_handler.html#a5af6a6e66e8754591b3425addc6e6858">brtr::KeyHandler::handleKeyDown</a></div><div class="ttdeci">bool handleKeyDown(const osgGA::GUIEventAdapter &amp;ea, osgGA::GUIActionAdapter &amp;aa)</div><div class="ttdef"><b>Definition:</b> <a href="_key_handler_8cpp_source.html#l00053">KeyHandler.cpp:53</a></div></div>
<div class="ttc" id="classbrtr_1_1_key_handler_html_a492d086b9458475e595b3627a8dee0f9"><div class="ttname"><a href="classbrtr_1_1_key_handler.html#a492d086b9458475e595b3627a8dee0f9">brtr::KeyHandler::_programs</a></div><div class="ttdeci">std::vector&lt; osg::ref_ptr&lt; osg::Program &gt; &gt; _programs</div><div class="ttdef"><b>Definition:</b> <a href="_key_handler_8h_source.html#l00058">KeyHandler.h:58</a></div></div>
<div class="ttc" id="classbrtr_1_1_base_interaction_callback_html_a95ede7c8aa0dc1e067ae64615ecb23db"><div class="ttname"><a href="classbrtr_1_1_base_interaction_callback.html#a95ede7c8aa0dc1e067ae64615ecb23db">brtr::BaseInteractionCallback::reactivate</a></div><div class="ttdeci">void reactivate()</div><div class="ttdef"><b>Definition:</b> <a href="_base_interaction_callback_8cpp_source.html#l00035">BaseInteractionCallback.cpp:35</a></div></div>
<div class="ttc" id="classbrtr_1_1_key_handler_html_a1925fa114839192716167477714abfdc"><div class="ttname"><a href="classbrtr_1_1_key_handler.html#a1925fa114839192716167477714abfdc">brtr::KeyHandler::modifyText</a></div><div class="ttdeci">brtr::BaseInteractionCallback * modifyText(bool show)</div><div class="ttdoc">Shows the InteractionMessage on screen, if there is an InteractionObject beneath the mouse (e...</div><div class="ttdef"><b>Definition:</b> <a href="_key_handler_8cpp_source.html#l00101">KeyHandler.cpp:101</a></div></div>
<div class="ttc" id="classbrtr_1_1_base_interaction_callback_html_aafca24ccde1cf21f4132f65a83e0b2bc"><div class="ttname"><a href="classbrtr_1_1_base_interaction_callback.html#aafca24ccde1cf21f4132f65a83e0b2bc">brtr::BaseInteractionCallback::getNode</a></div><div class="ttdeci">osg::ref_ptr&lt; osg::Node &gt; getNode() const </div><div class="ttdef"><b>Definition:</b> <a href="_base_interaction_callback_8cpp_source.html#l00027">BaseInteractionCallback.cpp:27</a></div></div>
<div class="ttc" id="classbrtr_1_1_key_handler_html_aabad0b142ba1d2e648069b4e8af17797"><div class="ttname"><a href="classbrtr_1_1_key_handler.html#aabad0b142ba1d2e648069b4e8af17797">brtr::KeyHandler::~KeyHandler</a></div><div class="ttdeci">~KeyHandler()</div><div class="ttdef"><b>Definition:</b> <a href="_key_handler_8cpp_source.html#l00019">KeyHandler.cpp:19</a></div></div>
<div class="ttc" id="classbrtr_1_1_key_handler_html_a1b2404dcd19426a93d4474cd45da84e8"><div class="ttname"><a href="classbrtr_1_1_key_handler.html#a1b2404dcd19426a93d4474cd45da84e8">brtr::KeyHandler::_mouseEvent</a></div><div class="ttdeci">osg::ref_ptr&lt; const osgGA::GUIEventAdapter &gt; _mouseEvent</div><div class="ttdef"><b>Definition:</b> <a href="_key_handler_8h_source.html#l00059">KeyHandler.h:59</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_171b764decf33d63a7df2fab4f4bc6d8.html">GUI</a></li><li class="navelem"><a class="el" href="_key_handler_8cpp.html">KeyHandler.cpp</a></li>
    <li class="footer">Generated on Thu Jul 17 2014 01:40:24 for BrainTrain by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.7 </li>
  </ul>
</div>
</body>
</html>
